<?php
/*
 * name: cxm
 * desc: 用户表
 * date: 2019/10/23
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('name')->comment('姓名');
            $table->string('mobile',15)->comment('用户手机');
            $table->string('card_no')->comment('工会服务卡号');
            $table->tinyInteger('sex')->default(3)->comment('性别 1男2女3保密');
            $table->string('qr_code')->comment('用户专属二维码');
            $table->tinyInteger('status')->default(1)->comment('状态 1正常 2冻结');
            $table->timestamp('frozen_time')->nullable()->comment('冻结时间');
            $table->timestamps();
            $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."users` comment'用户表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
